home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / bluebook.zip / GRAPHICS.DOC < prev    next >
Text File  |  1986-05-08  |  14KB  |  352 lines

  1. GRAPHICS.DOC -- Graphic Plotting Procedures
  2. ===========================================
  3.  
  4.   From `BLUEBOOK of ASSEMBLY ROUTINES for the IBM PC & XT'
  5.         by Christopher L. Morgan
  6.         Copyright (C) 1984 by The Waite Group, Inc.
  7.  
  8.   Purpose: GRAPHICS.ASM contains routines to perform fundamental plotting jobs
  9.     on the IBM PC. These include point plotting, line drawing, character
  10.     drawing, and filling of areas.  GRAPHICS.DOC describes the routines.
  11.  
  12.    Contents:
  13.    ---------
  14.    CLS        --  Clear the screen
  15.    GET_COLOR    --  Get the color of a point on the med res color screen
  16.    GMSG_OUT    --  Plot a string
  17.    PAINT    --  Fill an area with specified color
  18.    RCHAR    --  Plot a raster character
  19.    SCHAR    --  Plot a stroke character
  20.    SET_BOX    --  Fill a rectangular box with specified color
  21.    SET_LIN    --  Draw a line
  22.    SET_PT    --  Plot a point
  23.    XOR_BOX    --  Fill a rectangular box using XOR
  24.    XOR_PT    --  Plot a point using XOR
  25.  _____________________________________________________________________________
  26.  
  27. Primitive Functions
  28. -------------------
  29.  
  30. CLS -- Clear the graphics screen.
  31.  
  32.   Function: This routine clears the color graphics screen.
  33.  
  34.   Input: None.
  35.  
  36.   Output: Just to the screen.
  37.  
  38.   Registers used: Unmodified; AX & CX are saved, then restored.
  39.  
  40.   Segments referenced: Upon entry, ES must point to screen RAM at B8000H.
  41.  
  42.   Routines called: None.
  43.  -----------------------------------------------------------------------------
  44. SET_PT -- Plot a point on the medium resolution color screen.
  45.  
  46.   Function: This routine plots a point on the medium resolution color graphics
  47.     screen. The pixel at the specified location is given a specified color,
  48.     over-writing the old color.
  49.  
  50.   Input: Upon entry:
  51.                 X-coordinate (0-319) of the point is in SI
  52.              Y-coordinate (0-199) of the point is in DI
  53.              color (0-3) is in DX.    
  54.  
  55.   Output: Just to the screen.
  56.  
  57.   Registers used: Unmodified; SI,DI, & DX are used for input.
  58.  
  59.   Segments referenced: Upon entry, ES must point to video RAM at B8000, and
  60.     DS must point to a data segment containing the following look-up table
  61.     of rotated color masks:
  62.  
  63.     CTABLE    DW    0003FH,0403FH,0803FH,0C03FH
  64.         DW    000CFH,010CFH,020CFH,030CFH
  65.         DW    000F3H,004F3H,008F3H,00CF3H
  66.         DW    000FCH,001FCH,002FCH,003FCH
  67.  
  68.   Routines called: None.
  69.  
  70.   Note: No bounds checking is performed.  Programmer must ensure the 
  71.     coordinates and color are in their proper ranges.
  72.  -----------------------------------------------------------------------------
  73. XOR_PT -- Plot a point using XOR onto the med res color screen.
  74.  
  75.   Function: This routine plots a point on the med res screen using the 
  76.     `exclusive or' operation. The pixel at the specified location is colored
  77.      with a color obtained by `exclusive oring' its original color with a
  78.      specified color.  This function is useful for making cursors.
  79.  
  80.   Input: Upon entry:
  81.                 X-coordinate (0-319) of the point is in SI
  82.              Y-coordinate (0-199) of the point is in DI
  83.              color (0-3) is in DX.    
  84.  
  85.   Output: Just to the screen.
  86.  
  87.   Registers used: Unmodified; SI,DI, & DX are used for input.
  88.  
  89.   Segments referenced: Upon entry, ES must point to video RAM at B8000, and
  90.     DS must point to a data segment containing the following look-up table
  91.     of rotated color masks:
  92.  
  93.     CTABLE    DW    0003FH,0403FH,0803FH,0C03FH
  94.         DW    000CFH,010CFH,020CFH,030CFH
  95.         DW    000F3H,004F3H,008F3H,00CF3H
  96.         DW    000FCH,001FCH,002FCH,003FCH
  97.  
  98.   Routines called: None.
  99.  
  100.   Note: No bounds checking is performed.  Programmer must ensure the 
  101.     coordinates and color are in their proper ranges.
  102.  
  103.  -----------------------------------------------------------------------------
  104. GET_COLOR  -- Get color of a point on med res screen.
  105.  
  106.   Function: This routine returns the color of a specified point on the med
  107.     res color screen.  The color is returned in AL.
  108.  
  109.   Input: Upon entry:
  110.                 X-coordinate (0-319) of the specified point is in SI
  111.              Y-coordinate (0-199) of the specified point is in DI.
  112.  
  113.   Output: Upon exit, AL contains the color (0-3) of the pixel at the 
  114.     specified location.
  115.  
  116.   Registers used: Only AX is modified.  SI & DI are used for input and AL is
  117.     used for output.
  118.  
  119.   Segments referenced: Upon entry, ES must point to the video RAM at B8000H.
  120.  
  121.   Routines called: None.
  122.  
  123.   Note: No bounds checking is performed.  Programmer must ensure the 
  124.     coordinates and color are in their proper ranges.
  125.  -----------------------------------------------------------------------------
  126. SET_BOX -- Fill a rectangular box.
  127.  
  128.   Function: This routine fills a rectangular box on the color graphics screen
  129.     with a specified color.
  130.  
  131.   Input: Upon entry:
  132.              X-coordinate of upper left corner is in X1
  133.              Y-coordinate of upper left corner is in Y1
  134.              X-coordinate of lower right corner is in X2
  135.              Y-coordinate of lower right corner is in Y2
  136.              Color of the rectangle is in bits 0 & 1 of COLOR.
  137.  
  138.   Output: Just to the screen.
  139.  
  140.   Registers used: Unmodified; SI, DI, DX, BX, CX, & AX are save & restored.
  141.  
  142.   Segments referenced: Upon entry, ES must point to video RAM at B8000, and
  143.     DS must point to a data segment containing the following look-up table
  144.     for color masks:
  145.  
  146.     XTABLE    DW    0FFC0H,0FFF0H,0FFFCH,0FFFFH
  147.         DW    03FC0H,03FF0H,03FFCH,03FFFH
  148.         DW    00FC0H,00FF0H,00FFCH,00FFFH
  149.         DW    003C0H,003F0H,003FCH,003FFH
  150.  
  151.   Routines called: None.
  152.  
  153.   Note: No bounds checking is performed.  Programmer must ensure the 
  154.     coordinates are in their proper range and order; i.e., the following
  155.     must be true:
  156.          0 <= X1 <= X2 <= 319
  157.          0 <= Y1 <= Y2 <= 199.
  158.  -----------------------------------------------------------------------------
  159. XOR_BOX -- Fill a rectangular box using XOR.
  160.  
  161.   Function: This routine fills a rectangular box in the color graphics screen
  162.     with a given color using the `exclusive or' operation. Each pixel in the
  163.     rectangle is colored with a color obtained by `exclusive oring' its 
  164.     original color with a specified color.  This function is useful for 
  165.     making cursors.
  166.  
  167.   Input: Upon entry:
  168.              X-coordinate of upper left corner is in X1
  169.              Y-coordinate of upper left corner is in Y1
  170.              X-coordinate of lower right corner is in X2
  171.              Y-coordinate of lower right corner is in Y2
  172.              Color of the rectangle is in bits 0 & 1 of COLOR.
  173.  
  174.   Output: Just to the screen.
  175.  
  176.   Registers used: Unmodified; SI, DI, DX, BX, CX, & AX are saved & restored.
  177.  
  178.   Segments referenced: Upon entry, ES must point to video RAM at B8000, and
  179.     DS must point to a data segment containing the following look-up table
  180.     for color masks:
  181.  
  182.     XTABLE    DW    0FFC0H,0FFF0H,0FFFCH,0FFFFH
  183.         DW    03FC0H,03FF0H,03FFCH,03FFFH
  184.         DW    00FC0H,00FF0H,00FFCH,00FFFH
  185.         DW    003C0H,003F0H,003FCH,003FFH
  186.  
  187.   Routines called: None.
  188.  
  189.   Note: No bounds checking is performed.  Programmer must ensure the 
  190.     coordinates are in their proper range and order; i.e., the following
  191.     must be true:
  192.          0 <= X1 <= X2 <= 319
  193.          0 <= Y1 <= Y2 <= 199.
  194.  -----------------------------------------------------------------------------
  195.     
  196. Second Level Functions (use Primitive Functions)
  197. ----------------------
  198.  
  199. SET_LIN -- Draw a line.
  200.  
  201.   Function: This routine draws a line from (X1,Y1) to (X2,Y2) in the specified
  202.     color.  It uses Bresenham's algorithm.
  203.  
  204.   Input: Upon entry:
  205.              X-coordinate of starting point is in X1
  206.              Y-coordinate of starting point is in Y1
  207.              X-coordinate of ending point is in X2
  208.              Y-coordinate of ending point is in Y2
  209.              Color of line is in COLOR.
  210.  
  211.   Output: Just to the screen.
  212.  
  213.   Registers used: Unmodified; BX, CX, DX, SI, DI, & AX are saved & restored.
  214.  
  215.   Segments referenced: Upon entry, ES must point to video RAM at B8000H, and
  216.     DS must point to a data segment used by the SET_PT plotting routine.
  217.  
  218.   Routines called: SET_PT.
  219.  
  220.   Note: No bounds checking is performed.  Programmer must ensure the 
  221.     coordinates are in their proper range; i.e., the following
  222.     must be true:
  223.          0 <= X1 & X2 <= 319
  224.          0 <= Y1 & Y2 <= 199
  225.